package com.dubito.concurrency.example.singleton;

import com.dubito.concurrency.annotation.NoThreadSafe;
import com.dubito.concurrency.annotation.ThreadSafe;

/**
 * @author liliang
 * @description: 饿汉模式
 * @date 2018/6/24.
 */
@ThreadSafe
public class SingletonExample2 {

    /**
     *  私有构造
     */
    private SingletonExample2(){}

    /**
     * 单例对象
     */
    private static SingletonExample2 instance = new SingletonExample2();

    /**
     * 静态的工厂方法
     * @return
     */
    public static SingletonExample2 getInstance () {
        return instance;
    }
}
